package server.business.login.handler;

import java.util.List;

import com.core.initialize.Message;
import com.google.protobuf.GeneratedMessage;

import server.ServerHandler;
import server.business.login.data.gm.GmOptionalFactory;
import server.business.login.data.gm.IGmOptional;
import server.commonData.User;
import server.msgBean.LoginMessage.GmOptionalReq;

public class GmOptionalHandler extends ServerHandler {

	@Override
	public Class<? extends GeneratedMessage> initBodyClass() {
		return GmOptionalReq.class;
	}

	@Override
	protected void handler(Message msg, User user) throws Throwable
	{
		GmOptionalReq req = msg.getBody();
		IGmOptional optional = GmOptionalFactory.getGmOptional(req.getGmOptional(0));
		List<String> optionals = req.getGmOptionalList();
		optionals.remove(0);
		optional.exeOptional(user, optionals);
	}
}
